<?php

namespace Com\Wechat\Card;
class Signature{
	function __construct(){
		$this->data = array();
	}
	function add_data($str){
		array_push($this->data, (string)$str);
	}
	function get_signature(){
		sort( $this->data, SORT_STRING );
		return sha1( implode( $this->data ) );
	}
};

//----------------------check signature------------------------
/*
$signature = new Signature();
$signature->add_data( "875e5cc094b78f230b0588c2a5f3c49f" );
$signature->add_data( "wx57bf46878716c27e" );
$signature->add_data( "213168808" );
$signature->add_data( "12345" );
$signature->add_data( "55555" );
echo $signature->get_signature();
*/
?>